<?php
include("../../inc/global.php");
include("../menusys/function.php");
adminislogin();
if(strtolower($_SERVER['REQUEST_METHOD'])=="get"){
	
	$type=isset($_GET["Type"])?$_GET["Type"]:'';
	$id=isset($_GET["id"])?$_GET["id"]:'';
	if(strtolower($type)=="del"){
		if(!empty($id)||is_numeric($id)){
			$db->exec("delete from sysadmin where sysadmin0={$id}");
		}
	}
}
if(strtolower($_SERVER['REQUEST_METHOD'])=="post"){
	header('Content-type: text/html;charset=utf-8');
	$sysadmin1=$_POST["AdminSys1"];
	$sysadmin2=md5("qingmi");
	$sysadmin3=$_POST["AdminSys2"];
	$sysadmin5=$_POST["AdminSys3"];
	$addSql="insert into sysadmin(sysadmin1,sysadmin2,sysadmin3,sysadmin5)values('{$sysadmin1}','$sysadmin2','$sysadmin3','$sysadmin5')";
	if($db->query($addSql)){
	//$base->alert("添加成功，初始密码为 [666666]");
		YKT_error('添加成功，初始密码为 [qingmi]',$_SERVER['HTTP_REFERER']);
	}else{
		YKT_error('添加失败',$_SERVER['HTTP_REFERER']);
	}
}


echo "<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>用户管理</title>
<link href=\"../../Css.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>
<body>
<p>当前位置：系统管理 > 用户管理</p>
		<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">
		<table width=\"100%\" border=\"0\" align=\"center\" cellspacing=\"1\" style=\"background-color: #0099cc;\">
		  <tr class=\"YKTth\" Height=\"25\">
			<th width=\"6%\" style='background-color:#616975' scope=\"col\">ID</th>
			<th width=\"20%\" style='background-color:#616975' scope=\"col\">用户名</th>
			<th width=\"20%\" style='background-color:#616975' scope=\"col\">身份</th>
			<th width=\"20%\" style='background-color:#616975' scope=\"col\">注册时间</th>
			<th width=\"37%\" style='background-color:#616975' scope=\"col\">操作</th>
		  </tr>";
		  $result=$db->query("select * from sysadmin where sysadmin6=0 and sysadmin1<>'qingmiadmin'");
		  while($row=$db->getarray($result)){
			  echo "<tr Height=\"25\" class=\"YKTtd \">
				<td><div align=\"center\">{$row[0]}</div></td>
				<td><div align=\"center\">{$row[1]}</div></td>
				<td><div align=\"center\">{$row[3]}</div></td>
				<td><div align=\"center\">{$row[5]}</div></td>
				<td><div align=\"center\"><a href=\"?Type=del&id={$row[0]}\" onclick=\"return confirm('你确认要删除用户 [{$row[1]}] 吗？')\" class=\"Link12\">删除</a> | <a href=\"rules.php?UserID={$row[0]}\" class=\"Link12\">权限管理 </a></div></td>
			  </tr>";
		  }
	  	  echo "<tr class=\"YKTth\" >
		    <td>&nbsp;</td>
		    <td><label>
            <div align=\"center\">
              <input type=\"text\" name=\"AdminSys1\" />
            </div>
		    </label></td>
		    <td><div align=\"center\">
		      <input type=\"text\" name=\"AdminSys2\" />
		      </div></td>
		    <td><div align=\"center\">
		      <input type=\"text\" name=\"AdminSys3\" Value=\"".date("Y-m-d h:i:s")."\" />
		      </div></td>
		    <td><label>
		      <div align=\"center\">
		        <input type=\"submit\" name=\"Submit\" value=\"添加新用户\" />
	          </div>
		    </label></td>
	      </tr>
		</table>
	  </form>
	    　　新用户的默认密码为:qingmi
</body>
</html>";
?>